home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_300 / 343_02 / rstring.c < prev    next >
Text File  |  1990-08-16  |  1KB  |  58 lines

  1.  
  2.         /*****************************************************
  3.         *
  4.         *       file d:\cips\rstring.c
  5.         *
  6.         *       Functions: This file contains
  7.         *            read_string
  8.         *            clear_buffer
  9.         *            long_clear_buffer
  10.         *
  11.         *       Purpose: This function reads a string of input
  12.         *            from the keyboard.
  13.         *
  14.         *******************************************************/
  15.  
  16. #include "d:\cips\cips.h"
  17.  
  18.  
  19. read_string(string)
  20.         char *string;
  21. {
  22.         int     eof,
  23.                 letter,
  24.                 no_error;
  25.  
  26.         eof = -1;
  27.         no_error = 0;
  28.  
  29.         while((letter = getchar()) != '\n' &&
  30.                letter !=  eof)
  31.            *string++ = letter;
  32.  
  33.         *string = '\0';
  34.  
  35.         return((letter == eof) ? eof : no_error);
  36.  
  37. }       /* ends read_string */
  38.  
  39.  
  40.  
  41. clear_buffer(string)
  42.    char string[];
  43. {
  44.    int i;
  45.    for(i=0; i<MAX_NAME_LENGTH; i++)
  46.       string[i] = ' ';
  47. }
  48.  
  49.  
  50.  
  51. long_clear_buffer(string)
  52.    char string[];
  53. {
  54.    int i;
  55.    for(i=0; i<300; i++)
  56.       string[i] = ' ';
  57. }
  58.